package com.example.diagnose.Util;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    //跨域配置
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        //允许跨域访问资源
        registry.addMapping("/**")
                .allowedOrigins("http://127.0.0.1:8081")
                .allowedMethods("POST", "GET", "DELETE", "PUT", "HEAD");
    }
}

